package the.formula.calculator;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;

public class Geometry extends Activity {

    private double answer = 0;
        
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.geometry_activity);
    }
        
    private void polygonAngles(double x) {
        double result = (x - 2) * 180;
        answer = result;
    }
    
    public void onClick(View v) {
        Intent i = null;
        switch(v.getId()) {
            case R.id.degrees:
                i = new Intent(this, DegreesInPolygon.class);
                break;
            case R.id.area:
                i = new Intent(this, Area.class);
                break;
            case R.id.volume:
                i = new Intent(this, Objects.class);
                break;
        }
        if(i != null) {
            startActivity(i);
        }
    }
        /****                   Volume Formulas                 ****/
        
    private void cubeVolume(double length) {
        double result = length * length * length;
        answer = result;
    }
    
    private void prismVolume(double length, double width, double height) {
        double result = length * width * height;
        answer = result;
    }
    
    private void cylinderVolume(double radius, double height) {
        double result = Math.PI * radius * radius * height;
        answer = result;
    }
    
    private void pyramidVolume(double base, double height) {
        double result = base * base * height / 3;
        answer = result;
    }
    
    private void coneVolume(double radius, double height) {
        double result = Math.PI * radius * radius * height / 3;
        answer = result;
    }
    
    private void sphereVolume(double radius) {
        double result = Math.PI * radius * radius * radius * 4 / 3;
        answer = result;
    }
    
    private void ellipseVolume(double radius1, double radius2, double radius3) {
        double result = Math.PI * radius1 * radius2 * radius3 * 4 / 3;
        answer = result;
    }
    
    private void triangularPrismVolume(double triangleHeight, double triangleBase, double length) {
        double result = .5 * triangleHeight * triangleBase * length;
        answer = result;
    }
    
    
    /****                   Surface Area Formulas                   ****/
    
    private void cubeSurfaceArea(double length) {
        double result = 6 * (length * length);
        answer = result;
    }
    
    private void prismSurfaceArea(double length, double width, double height) {
        double result = 2 * length * width + 2 * width * height + 2 * length * height;
        answer = result;
    }
    
    private void sphereSurfaceArea(double radius) {
        double result = Math.PI * radius * radius * 4;
        answer = result;
    }
    
    private void cylinderSurfaceArea(double radius, double height) {
        double result = radius * radius * Math.PI * 2 + radius * height * Math.PI * 2;
        answer = result;
    }
    
    private void pyramidSurfaceArea(double base, double sideLength) {
        double result = 2.0 * base * sideLength + base * base;
        answer = result;
    }
    
    private void ellipseSurfaceArea(double radius1, double radius2) {
        double result = Math.PI * radius1 * radius2;
        answer = result;
    }
    
    private void triangularPrismSurfaceArea(double triangleHeight, double triangleBase, double triangleSideLength, double length) {
        double result = triangleBase * triangleHeight + 2.0 * triangleSideLength * length + triangleBase * length;
        answer = result;
    }
}

